a = input()
sp = []
skobki = {'(': ')', '[': ']', '{': '}', '<': '>'}
for el in a:
    if el in skobki.keys():
        sp.append(el)
    elif el in skobki.values():
        if not sp or skobki[sp.pop()] != el:
            break
if not sp:
    print('True')
else:
    print('False')
